package main

import (
	"context"
	"log"
	"myprotobuf/build/gen/myprotobuf/grpctest"

	"google.golang.org/grpc"
)

func main() {
	conn, err := grpc.Dial(":8888", grpc.WithInsecure(), grpc.WithBlock())
	if err != nil {
		log.Fatalf("fail to dial: %v", err)
	}

	defer conn.Close()
	client := grpctest.NewGreeterClient(conn)
	r, err := client.SayHello(context.Background(), &grpctest.HelloRequest{Name: "guanguan"})
	if err != nil {
		log.Fatalf("request fail: %v", err)
	}
	log.Printf("get a response: %s", r.GetMessage())

}
